﻿@using Web.ViewModels
@model CatalogProduces

@{
    ViewBag.Title = "Результат поиска";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div id="catalog">
    <div id="Name_catalog">@Model.Name</div>
    <form action="#">
        @if (Model.Items!=null && Model.Items.Any())
        {
            <table id="browse">
                @foreach (ItemsForSale item in Model.Items)
                {

                    <tr>
                        <td class="name_tea">@item.Name</td>
                        <td></td>
                    </tr>
                    <tr>
                        <td class="about_tea">
                            @item.About
                        </td>
                        <td>
                            <div>
                                @if (item.ProductArtUrl != null)
                                {
                                    <img src="@Url.Content(item.ProductArtUrl)"/>
                                }
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <table class="option">
                                <tr>
                                    <td>Категория</td>
                                    <td class="none">@item.Category</td>
                                </tr>
                                <tr>
                                    <td>Производитель</td>
                                    <td class="none">@item.Producer</td>
                                </tr>
                                <tr>
                                    <td>Цена в гривнах</td>
                                    <td id="prod-price-@item.ProduceId" class="none">@item.Price</td>
                                </tr>
                                <tr>
                                    <td>Упаковка (г)</td>

                                    <td  class="none">@Html.DropDownListFor(
                                                          x => x.Items,
                                                          new SelectList(item.Packages, "Id", "Weight"),
                                                          new {@class = "dropDown", storeId = item.Id, prodId = item.ProduceId}


                                                          )
                                    </td>
                                </tr>
                            </table>
                            @if (item != Model.Items.Last())
                            {
                                <hr />
                            }
                       
                        </td>
                        <td>
                        
                            <div id="button">
                                <span id="pr-buy-@item.ProduceId">
                                    @Html.ActionLink("Заказать", "AddToCart",
                                        "ShoppingCart", new {id = @item.Id}, "")
                                </span>
                            </div>
                        </td>
                    </tr>
                }
            </table>
        }
        else
        {
            
            <table id="browse"  style="height: 250px;">
                <tr>
                    <td rowspan="2">
                        <p>Ваш поиск не дал результатов</p>
                    </td>
                </tr>
            </table>

        }
    </form>
</div>
